{extend name="index/iframe" /}

{block name="content"}
<form class="layui-form" action="" style="padding-top:10px; padding-right:10px;">
    <input type="hidden" name="id" value="{$Think.get.id}">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">游戏主体</label>
            <div class="layui-input-inline">
                <select name="app_id" lay-filter="app_id" id="app_id" lay-verify="required" lay-search="">
                    <option value="">请选择游戏主体</option>
                    {volist name="$app_id" id="vo"}
                    <option value="{$vo.app_id}" {$find.app_id==$vo.app_id ? 'selected' : ''}>{$vo.app_id}：{$vo.app_name}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">游戏部门</label>
            <div class="layui-input-inline">
                <select name="app_type_id" lay-filter="app_type_id" id="app_type_id" lay-verify="required">
                    <option value="">请选择游戏部门</option>
                    {volist name="$app_type_id" id="vo"}
                    <option value="{$vo.id}" {$find.app_type_id==$vo.id ? 'selected' : '';}>{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">游戏版本</label>
            <div class="layui-input-inline">
                <select name="app_publish_type_id" lay-filter="app_publish_type_id" id="app_publish_type_id" lay-verify="required">
                    <option value="">请选择游戏版本</option>
                    {volist name="$app_publish_type_id" id="vo"}
                    <option value="{$vo.id}" {$find.app_publish_type_id==$vo.id ? 'selected' : '';}>{$vo.name}</option>
                    {/volist}
                </select>
            </div>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">服务器名称</label>
            <div class="layui-input-inline">
                <input type="text" name="server_name" value="{$find.server_name}" lay-verify="required" placeholder="请输入服务器名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">游戏名称</label>
            <div class="layui-input-inline">
                <input type="text" name="game_name" value="{$find.game_name}" lay-verify="required" placeholder="请输入游戏名称" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">充值比例</label>
            <div class="layui-input-inline">
                <input type="text" name="charge_rate" value="{$find.charge_rate}" id="language" lay-verify="required|number" placeholder="请输入充值比例" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">游戏图标</label>
        <div class="layui-input-block">
            <input type="text" name="icon" value="{$find.icon}" id="icon" placeholder="请输入游戏图标" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn my-btn" lay-submit="" lay-filter="submitBtn">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}

{block name="css"}
<style>

    .layui-form-selected dl {z-index:10000;}
</style>
{/block}

{block name="js"}
<script>
    layui.use(['form', 'laydate', 'element', 'upload'], function(){
        var form = layui.form
            ,$ = layui.$
            ,layer = layui.layer;

        //提交
        form.on('submit(submitBtn)', function(data){
            var load = layer.load();
            $.post('{:url("GameList/serverEdit")}',data.field, function(json){
                layer.close(load);
                json.code==0 ? layer.msg(json.msg, {icon: 1, time: 1000}) : layer.msg(json.msg, {icon: 0, time: 1000});
            }, 'JSON').error(function(){
                layer.close(load);
                layer.msg('连接超时，请联系后台管理员', {icon: 2, time:3000});
            });
            return false;
        });
    });
</script>
{/block}